<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">
$(function() {
	parent.$.messager.progress('close');
	
	$('#organizationId').combotree({
        url : '${pageContext.request.contextPath }/sys/organization/tree',
        parentField : 'pid',
        lines : true,
        panelHeight : 'auto',
        value : '${entity.organizationId}'
     });

    $('#roleIds').combotree({
        url : '${pageContext.request.contextPath }/sys/sysRole/tree',
        parentField : 'pid',
        lines : true,
        panelHeight : 'auto',
        multiple : true,
        required : true,
        cascadeCheck : false
    });
    // 设置默认值
    var roleIdStr = ${roleIds };
    $('#roleIds').combotree('setValues', roleIdStr);

    $('#editForm').form({
        url : '${pageContext.request.contextPath }/sys/sysUser/edit',
        onSubmit : function() {
            progressLoad();
            var isValid = $(this).form('validate');
            if (!isValid) {
                progressClose();
            }
            return isValid;
        },
        success : function(result) {
            progressClose();
            result = $.parseJSON(result);
            if (result.success) {
            	parent.$.messager.alert('提示',result.msg,'info');
                parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                parent.$.modalDialog.handler.dialog('close');
            } else {
                parent.$.messager.alert('错误', result.msg, 'error');
            }
        }
    });
    $("#sex").val('${entity.sex}');
    $("#status").val('${entity.status}');
});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
        <form id="editForm" method="post">
            <div class="light-info" style="overflow: hidden;padding: 3px;">
                <div>密码不修改请留空。</div>
            </div>
            <table class="grid">
                <tr>
                    <td>登录名</td>
                    <td><input name="id" type="hidden"  value="${entity.id}">
                    	<input name="loginName" type="text" placeholder="请输入登录名称" class="easyui-validatebox" 
                    		data-options="required:true" value="${entity.loginName}"></td>
                    <td>姓名</td>
                    <td><input name="realName" type="text" placeholder="请输入姓名" class="easyui-validatebox" 
                    	data-options="required:true" value="${entity.realName}"></td>
                </tr>
                <tr>
                    <td>密码</td>
                    <td><input type="text" name="password" placeholder="不修改请留空" /></td>
                    <td>性别</td>
                    <td><select name="sex" id="sex"  class="easyui-combobox" 
                    		data-options="width:140,height:29,editable:false,panelHeight:'auto'">
                            <option value="0">保密</option>
                            <option value="1">男</option>
                            <option value="2">女</option>
                    </select></td>
                </tr>
                <tr>
                	<td>电话</td>
                    <td>
                        <input type="text" name="phone" class="easyui-numberbox" value="${entity.phone}"/>
                    </td>
                    <td>出生日期</td>
                    <td><input name="birthday" placeholder="请输入出生日期" 
                    	onclick="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd'})" 
                    	value="${entity.birthday}" readonly="readonly" />
                    </td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td><select id="state" name="status" class="easyui-combobox" 
                    		data-options="width:140,height:29,editable:false,panelHeight:'auto'">
                            <option value="0">正常</option>
                            <option value="1">冻结</option>
                    </select></td>
                    <td>角色</td>
                    <td><input id="roleIds" name="roleIds" style="width: 140px; height: 29px;"/></td>
                </tr>
                <tr>
                    <td>部门</td>
                    <td colspan="3"><select id="organizationId" name="organizationId" style="width: 140px; height: 29px;" class="easyui-validatebox" data-options="required:true"></select></td>
                </tr>
            </table>
        </form>
    </div>
</div>